import {HotSearchListDetailed,SearchsuggestionsList,SearchdetailsList,Getalbumcontent,Albumdynamicinformation,
  Albumreviewlist
} from '@/api/api'
const state={
 //搜索热搜榜
 SearchListDetailed:[],
//搜索建议
Searchresult:[],
//搜索详情
SearchdetailsList:[],
resultsongs:[],
//专辑动态信息
commentCount:{},
 //获取专辑内容
albumsongs:{},
//专辑评论
albumreviewlist:{}
};
const mutations={
 //搜索热搜榜
 HOTSEARCHLISTDETAILED(state,SearchListDetailed){
  state.SearchListDetailed = SearchListDetailed
 },
  //搜索建议
  SEARCHSUGGETIONSLIST(state, Searchresult){
    state.Searchresult = Searchresult
  },
  //搜索详情
  SEARCHDETAILSLIST(state,resultsongs){
    state.resultsongs = resultsongs
  },
   //专辑动态信息
   ALBUMDYNAMICINFORMATION(state,commentCount){
    state.commentCount = commentCount
   },
     //获取专辑内容
     GETABUMCONTENT(state,albumsongs){
      state.albumsongs = albumsongs
     },
     //专辑评论
     ALBUMREVIEWLIST(state,albumreviewlist){
      state.albumreviewlist = albumreviewlist
     }
};
const actions={
  //搜索热搜榜
 async getHotSearchListDetailed({commit}){
  let request = await HotSearchListDetailed()
  if(request.data.code==200){
    commit('HOTSEARCHLISTDETAILED',request.data.data)
  }
  },
  //搜索建议
 async getSearchsuggestionsList({commit},{keywords}){
   let request = await SearchsuggestionsList(keywords)
   if(request.data.code==200){
    commit('SEARCHSUGGETIONSLIST',request.data.result)
   }
  },
  //搜索详情
 async getSearchdetailsList({commit},{keywords,limit,offset,type}){
    let request = await SearchdetailsList({keywords,limit,offset,type})
    console.log(request);
    if(request.data.code==200){
      commit('SEARCHDETAILSLIST',request.data.result)
    }
  },
  //获取专辑内容
 async getGetalbumcontent({commit},{id}){
  let request = await Getalbumcontent(id)
  commit('GETABUMCONTENT',request.data)
  },
  //专辑动态信息
 async getAlbumdynamicinformation({commit},{id}){
  let request = await Albumdynamicinformation(id)
  commit('ALBUMDYNAMICINFORMATION',request.data)
  },
  //专辑评论
 async getAlbumreviewlist({commit},{id,limit,offset}){
  let request = await Albumreviewlist({id,limit,offset})
  console.log(request);
  commit('ALBUMREVIEWLIST',request.data)
  }
};

const getter={
};
export default{
  state,
  mutations,
  actions,
  getter
}